﻿using UnityEngine;

namespace CornerMemo
{
    public static class LogColor
    {
        public static T InfoColor<T>(this T message, Color? color = null)
        {
#if UNITY_EDITOR
            if (color == null)
            {
                Debug.Log(message);
            }
            else
            {
                Debug.Log($"<color=#{ColorUtility.ToHtmlStringRGB(color.Value)}>{message}</color>");
            }
#endif
            return message;
        }

        public static T WarningColor<T>(this T message, Color? color = null)
        {
#if UNITY_EDITOR
            color ??= new Color(1, 0.5f, 0);
            Debug.LogWarning($"<color=#{ColorUtility.ToHtmlStringRGB(color.Value)}>{message}</color>");
#endif
            return message;
        }

        public static T ErrorColor<T>(this T message, Color? color = null)
        {
#if UNITY_EDITOR
            color??= new Color(1, 0, 0);
            Debug.LogError($"<color=#{ColorUtility.ToHtmlStringRGB(color.Value)}>{message}</color>");
#endif
            return message;
        }
        
    }
}